<?php
$title="Trang quản trị";
require '../layout/headeradmin.inc';
?>
<script>
$(document).ready(function(){
$(".active input:checkbox").change(function(){
		if($(this).is(":checked"))
		{
			$.get("checked.php?cate=them&id="+$(this).val());
		}
		else
		{
			$.get("checked.php?cate=xoa&id="+$(this).val());
		}
	});

});
</script>


<div id="menu-main">
    <a href="createCategory.php">create new</a> 
     <a href="createCategory.php">create new</a> 
      
</div>
     
    <fieldset>
        <legend><text>Danh mục</text></legend>
        <table id="user">
            <thead>
                <tr>
<!--                    <td><input type="checkbox" name="chkall" id="chkall" /></td>-->
                    <td>Tên danh mục</td>
                    
					<td>Hoạt động</td>
                     <td>Ngày tạo</td>
                     <td>Thao tác</td>
                </tr>
            </thead>
            <tbody>
                <?php
                $data= $k->getAllCate();
                
                $i=0;
                while ($row = mysqli_fetch_array($data))
                {
                    
                   if(($i%2)==0)
                   {
                       echo'<tr class="odd">';
                   }
                    else {
                      echo '<tr>';
                    }
                        
                        ?>                
                        
<!--                            <td><input type="checkbox" class="chkall" /></td>-->
                            <td><?php echo $row['name_cate']; ?></td>
                           
                            <td  class="active"><input type="checkbox" <?php if($row['Active']=='1') echo ' checked'; ?> value="<?php echo $row['id']; ?>" >  </td>
                            <td><?php echo date('d/m/Y',strtotime( $row['created_time'])); ?></td>
                           
                             <td><a href="editUser.php?ac=cate&id=<?php echo $row['id']; ?>">Sửa</a>-<a href="Delete.php?ac=cate&id=<?php echo $row['id']; ?>">Xóa</a></td>
        </tr>             

                        <?php
                        $i++;
                }
                ?>
            </tbody>
            <tfoot>
                <tr>
                    <td> <p>Phân trang</p></td>
            </tr>
            </tfoot>
        </table>
        
    </fieldset>
</div>
<?php
require '../layout/footeradmin.inc';
/*}
 else {
    header("Location:index.php");
}
*/
?>
